package police;

/**
 * 汽车
 */
public class Car {
    /**
     * 车牌号
     */
    private String number;
    /**
     * 车速
     */
    private int speed;
    /**
     * 驾驶员
     */
    private Driver driver;

    public Car() {
    }

    public Car(String number, int speed, Driver driver) {
        this.number = number;
        this.speed = speed;
        this.driver = driver;
    }

    /**
     * 加速
     */
    public void addSpeed(){
        if(this.speed < 240){
            this.speed++;
        }
    }
    /**
     * 减速
     */
    public void minusSpeed(){
        if(this.speed > 0){
            this.speed--;
        }
    }

    public String getNumber() {
        return number;
    }

    public void setNumber(String number) {
        this.number = number;
    }

    public int getSpeed() {
        return speed;
    }

    public void setSpeed(int speed) {
        this.speed = speed;
    }

    public Driver getDriver() {
        return driver;
    }

    public void setDriver(Driver driver) {
        this.driver = driver;
    }
}
